using System;
using System.Collections.Generic;
using System.Text;
using BizTalkCop.Rules.Bases;
using Microsoft.FxCop.Sdk;

namespace BizTalkCop.Rules.Naming.Rules
{
    /// <summary>
    /// Rule verifying that orchestration names are Pascal cased
    /// </summary>
    public class OrchestrationNamesShouldBePascalCased : OrchestrationRuleBase
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        public OrchestrationNamesShouldBePascalCased() : base("OrchestrationNamesShouldBePascalCased") {}

        /// <summary>
        /// Checks if the orchestration name is Pascal cased
        /// </summary>
        /// <param name="type">Type to check</param>
        /// <returns>Problem collection</returns>
        public override ProblemCollection Check(TypeNode type)
        {
            string name = type.Name.Name;
            if (IsOrchestration(type) && !MemberName.IsPascalCase(name))
            {
                Problems.Add(new Problem(GetNamedResolution("Case", name, MemberName.ToPascalCase(name)), type));
            }
            return Problems;
        }
    }
}
